﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Voize
{
    internal partial class fNewUser : Form
    {



        internal fNewUser(CRemoteAuthentication autentication)
        {
            InitializeComponent();
            m_Autentication = autentication;
        }


        private CRemoteAuthentication m_Autentication;



        private void fNewUser_Load(object sender, EventArgs e)
        {
            List<string> Usernames = m_Autentication.GetAllUsernames();

            foreach (string username in Usernames)
            {
                listUsers.Items.Add(username);
            }

        }



        private void bClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }



        private void bAdd_Click(object sender, EventArgs e)
        {
            if (tUser.Text != "" && tPassword.Text != "")
            {
                m_Autentication.AddUser(tPassword.Text, tUser.Text);
                MessageBox.Show("User " + tUser.Text + " added ok.", "User added.", MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }
        }



    }
}
